/*
 * Manual Arm Drive
 * 
 * Default command for both the PIDMainArmSubsystem and the 
 * PIDSecondaryArmSubsystem; this command allows for manual joystick control
 * of the robot's two arms from the Co-driver controller.
 */

package edu.wpi.first.wpilibj.templates.commands;

import edu.wpi.first.wpilibj.templates.LogitechController;

/**
 *
 * @author Jarrod Risley
 */

public class ManualArmDrive extends CommandBase {
    
    /*
     * Global Declarations
     */
    LogitechController armController;
    
    public ManualArmDrive() {
        // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis);
        
        requires(mainArm);
        requires(secondaryArm);
        
        System.out.println("Manual Arm Drive online.");
        
    } // end ManualArmDrive

    // Called just before this Command runs the first time
    protected void initialize() {
        
        armController = oi.getCoDriverController();
        
    } // end initialize

    // Called repeatedly when this Command is scheduled to run
    protected void execute() {
        
        double mainArmSpeed = armController.scale(armController.getLeftY(), 1);
        double secondaryArmSpeed = armController.scale(armController.getRightY(), 1);
        
        mainArm.manualDrive(mainArmSpeed);
        secondaryArm.manualDrive(secondaryArmSpeed);
        
    } // end execute

    // Make this return true when this Command no longer needs to run execute()
    protected boolean isFinished() {
        return false;
    } // end isFinished

    // Called once after isFinished returns true
    protected void end() {
    } // end end...lol

    // Called when another command which requires one or more of the same
    // subsystems is scheduled to run
    protected void interrupted() {
        end();
    } // end interrupted
    
} // end ManualArmDrive
